package top.chengdongqing.mishop.entities

import jakarta.persistence.Entity
import jakarta.persistence.EnumType
import jakarta.persistence.Enumerated
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table
import top.chengdongqing.mishop.enums.OrderRefundStatus
import top.chengdongqing.mishop.enums.PaymentMethod
import java.math.BigDecimal
import java.time.LocalDateTime

@Entity
@Table(name = "order_refunds")
data class OrderRefund(
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Int = 0,
    var orderId: Int,
    var userId: Int,
    var orderNumber: String,
    @Enumerated(EnumType.STRING)
    var status: OrderRefundStatus = OrderRefundStatus.PENDING_REFUND,
    var paidAmount: BigDecimal,
    var paymentOrderNumber: String,
    var refundAmount: BigDecimal,
    @Enumerated(EnumType.STRING)
    var refundMethod: PaymentMethod? = null,
    var refundOrderNumber: String? = null,
    var refundedAt: LocalDateTime? = null,
    var refundReason: String? = null,
    var refundFailureReason: String? = null,
) : BaseEntity()
